<template>
  <view>
    <scroll-view scroll-y style="height: 100%; width: 100%;">
      <view class="swiper-div u-flex-col">
        <u-card :border="false" box-shadow="0px 0px 8px #ddd6d6" :body-style="{padding:'0'}" :show-head="false">
          <view slot="body">
            <view class="card-row">
              <u-cell-group :border="false">
                <u-cell-item
                  v-for="(item,index) in infoListOne"
                  title-width="220"
                  :key="index"
                  :title-style="{color:'#333333'}"
                  :value-style="{display:'flex',paddingLeft:'20rpx',color:'#666666'}"
                  :arrow="false"
                  :value="list[item.value]"
                >
                  <text slot="title" v-html="item.name"></text>
                </u-cell-item>
              </u-cell-group>
            </view>
          </view>
        </u-card>
        <u-card :border="false" box-shadow="0px 0px 8px #ddd6d6" :body-style="{padding:'0'}" :show-head="false">
          <view slot="body">
            <view class="card-row">
              <u-cell-group :border="false">
                <u-cell-item
                  v-for="(item,index) in infoListTwo"
                  title-width="220"
                  :key="index"
                  :title-style="{color:'#333333'}"
                  :value-style="{display:'flex',paddingLeft:'20rpx',color:'#666666'}"
                  :arrow="false"
                  :value="getValue(item)"
                >
                  <text slot="title" v-html="item.name"></text>
                </u-cell-item>
              </u-cell-group>
            </view>
          </view>
        </u-card>
      </view>
    </scroll-view>
  </view>
</template>

<script>
export default {
  name: 'index',
  props: {
    customerId: String
  },
  data() {
    return {
      infoListOne: [
        {
          name: '企业名称',
          value: 'shortName'
        },
        {
          name: '工商注册号',
          value: 'regNumeric'
        },
        {
          name: '工商登记机关',
          value: 'gsdjjg'
        },
        {
          name: '工商登记日期',
          value: 'gsdjrq'
        },
        {
          name: '行业类别',
          value: 'industryCategoryName'
        },
        {
          name: '所属监管行业',
          value: 'superviseIndustryName'
        },
        {
          name: '组织机构代码',
          value: 'orgCode'
        }
      ],
      infoListTwo: [
        {
          name: '成立日期',
          value: 'foundDate'
        },
        {
          name: '法定代表人',
          value: 'legalPerson'
        },
        {
          name: '联系电话',
          value: 'contactPhone'
        },
        {
          name: '法定代表人<br>-办公室电话',
          value: 'frdbbgdh'
        },
        {
          name: '法定代表人<br>-移动电话',
          value: 'frdbyddh'
        },
        {
          name: '电子邮箱',
          value: 'email'
        },
        {
          name: '邮政编码',
          value: 'postEncoding'
        },
        {
          name: '经济类型',
          value: 'economicTypeName'
        },
        {
          name: '行政区划',
          value: 'administrativeDivisionStr'
        },
        {
          name: '行政隶属',
          value: 'relationshipName'
        },
        {
          name: '企业状态',
          value: 'enterpriseStateName'
        },
        {
          name: '经度',
          value: '12'
        },
        {
          name: '纬度',
          value: '12'
        },
        {
          name: '联系人',
          value: 'contacts'
        },
        {
          name: '企业生产状态',
          value: 'produceStateName'
        },
        {
          name: '注册地址',
          value: 'address'
        },
        {
          name: '经营范围',
          value: 'businessScope'
        }
      ],
      list: {}
    }
  },
  mounted() {
    this.getData()
  },
  methods: {
    async getData() {
      let params = {}
      params.customerId = this.customerId
      const Res = await this.$form('/en/baseinfo/dataList', params)
      if (Res && Res.body) {
        this.list = Res.body
      }
    },
    getValue(item) {
      let value = ''
      let longitudeD = this.list.longitudeD ? this.list.longitudeD + '°' : ''
      let longitudeM = this.list.longitudeM ? this.list.longitudeM + '′' : ''
      let longitudeS = this.list.longitudeS ? this.list.longitudeS + '″' : ''
      let latitudeD = this.list.latitudeD ? this.list.latitudeD + '°' : ''
      let latitudeM = this.list.latitudeM ? this.list.latitudeM + '′' : ''
      let latitudeS = this.list.latitudeS ? this.list.latitudeS + '″' : ''
      if (item.name === '经度') {
        value = longitudeD + longitudeM + longitudeS
      } else if (item.name === '纬度') {
        value = latitudeD + latitudeM + latitudeS
      } else {
        value = this.list[item.value]
      }
      return value
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
